package org.loong.crypto.service.core.provider.impl;

import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.Set;

import org.loong.crypto.core.algorithm.SignatureAlgorithm;

/**
 * The base abstract class for ECDSA signers and verifiers.
 * 
 * <p>Supports the following algorithms:
 *
 * <ul>
 *     <li>{@link org.loong.crypto.core.algorithm.SignatureAlgorithm#SHA1_ECDSA}
 *     <li>{@link org.loong.crypto.core.algorithm.SignatureAlgorithm#SHA224_ECDSA}
 *     <li>{@link org.loong.crypto.core.algorithm.SignatureAlgorithm#SHA256_ECDSA}
 *     <li>{@link org.loong.crypto.core.algorithm.SignatureAlgorithm#SHA384_ECDSA}
 *     <li>{@link org.loong.crypto.core.algorithm.SignatureAlgorithm#SHA512_ECDSA}
 * </ul>
 */
public abstract class ECDSAProvider extends BaseSignatureProvider {

    /**
     * The supported signature algorithms by the ECDSA provider class.
     */
    public static final Set<SignatureAlgorithm> SUPPORTED_ALGORITHMS;

    static {
        Set<SignatureAlgorithm> algs = new LinkedHashSet<>();
        algs.add(SignatureAlgorithm.SHA1_ECDSA);
        algs.add(SignatureAlgorithm.SHA224_ECDSA);
        algs.add(SignatureAlgorithm.SHA256_ECDSA);
        algs.add(SignatureAlgorithm.SHA384_ECDSA);
        algs.add(SignatureAlgorithm.SHA512_ECDSA);
        SUPPORTED_ALGORITHMS = Collections.unmodifiableSet(algs);
    }

    /**
     * Creates a new ECDSA provider.
     */
    protected ECDSAProvider() {
        super(SUPPORTED_ALGORITHMS);
    }
}
